<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>

    let p1 = Promise.resolve(521);
    //如果传入的参数为 非Promise类型的对象，则返回的结果为成功的promise对象
    //如果传入的参数为Promise对象，则参数的结果决定了resolve的结果
    let p2 = Promise.resolve(new Promise((resolve,reject)=>{
      //resolve('OK');
      reject('Error')
    }))
    //console.log(p2);
    p2.catch(reason => {
      console.log(reason)
    })
  </script>
</body>
</html>